package com.dkd.day20250714;

import java.util.Scanner;

public class Main16 {
    public static void main(String[] args) {
        //给定一个url前缀和url后缀,通过,分割 需要将其连接为一个完整的url
        //
        //如果前缀结尾和后缀开头都没有/，需要自动补上/连接符
        //如果前缀结尾和后缀开头都为/，需要自动去重
        //约束：不用考虑前后缀URL不合法情况
        //
        //输入描述
        //url前缀(一个长度小于100的字符串)，url后缀(一个长度小于100的字符串)
        Scanner sc = new Scanner(System.in);
        String s = sc.nextLine();
        solve2(s);
    }

    public static void solve(String s) {
        if(s.length() == 1){
            System.out.println("/");
            return;
        }
        String[] words = s.split(",");
        StringBuilder sb = new StringBuilder();
        for (int i = 0; i < words.length; i++) {
            for (int j = 0; j < words[i].length(); j++) {
                char c = words[i].charAt(j);
                if (j == 0) {
                    if (c == '/') {
                        sb.append(c);
                    } else {
                        sb.append("/");
                        sb.append(c);
                    }
                }else if (j == words[i].length() - 1) {
                    if (c == '/') {

                    }else{
                        sb.append(c);
                    }
                }else{
                    sb.append(c);
                }

            }
            words[i] = sb.toString();
            sb.setLength(0);
        }
        for (int i = 0; i < words.length; i++) {
            sb.append(words[i]);
        }
        System.out.println(sb.toString());

    }

    public static void solve2(String s) {
       String[] arr= s.split(",");
        String prefix =arr.length>0 && arr[0].length()>0  ?arr[0]:"/";
        String suffix =arr.length>1 && arr[1].length()>0 ?arr[1]:"/";

       prefix= prefix.replaceAll("/+$","");
       suffix= suffix.replaceAll("^/+","");

        System.out.println(prefix+'/'+suffix);

    }
}
